<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="keyword" content="">

    <title>项目列表-工程巡查管理</title>

    <!-- Bootstrap core CSS -->
    <link href="__PUBLIC__/css/bootstrap.min.css" rel="stylesheet">
    <link href="__PUBLIC__/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="__PUBLIC__/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <link href="__PUBLIC__/assets/jquery-easy-pie-chart/jquery.easy-pie-chart.css" rel="stylesheet" type="text/css" media="screen"/>
    <link rel="stylesheet" href="__PUBLIC__/css/owl.carousel.css" type="text/css">
    <!-- Custom styles for this template -->
    <link href="__PUBLIC__/css/style.css" rel="stylesheet">
    <link href="__PUBLIC__/css/style-responsive.css" rel="stylesheet" />
    <!-- new styles-->
      <link href="__PUBLIC__/css/xxxstyle.css" rel="stylesheet" />
      
      <link rel="stylesheet" type="text/css" href="__PUBLIC__/assets/bootstrap-datepicker/css/datepicker.css" />
      <link rel="stylesheet" type="text/css" href="__PUBLIC__/assets/bootstrap-datetimepicker/css/datetimepicker.css" />      
      <link rel="stylesheet" type="text/css" href="__PUBLIC__/assets/jquery-multi-select/css/multi-select.css" />

      <!--new dynamic table-->
      <link href="__PUBLIC__/assets/advanced-datatable/media/css/demo_page.css" rel="stylesheet" />
      <link href="__PUBLIC__/assets/advanced-datatable/media/css/demo_table.css" rel="stylesheet" />
      <link rel="stylesheet" href="__PUBLIC__/assets/data-tables/DT_bootstrap.css" />
	  <link rel="stylesheet" href="__PUBLIC__/css/jquery.treeview.css" />
      <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
      <script src="__PUBLIC__/js/html5shiv.js"></script>
      <script src="__PUBLIC__/js/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>

  <section id="container">
      <!--main content start-->
      <section id="main-content">
          <section class="wrapper">
              <div class="row">
                  <div class="col-xs-12 maxColWid" >
                    	 <div class="row">
                          <div class="col-xs-12">
                              <section class="panel">
                                  <header class="panel-heading"><i class="icon-bookmark iconRed"></i>{$data.name}
                                     <span class="tools pull-right">
                                     	    <button type="button" id="pzReturn-btn" class="btn btn-default btn-xs" onclick="javascript:window.history.back();return false;"><i class="icon-reply"></i>返回</button>                                       
                                     </span>
                                  </header>
                                  <div class="panel-body">
                                      <div class="task-table-1 conProj">
                                          <div class="t1-row">
                                              <div class="row1-1 t1-bgA">项目名称</div>
                                              <div class="row4-1">{$data.name}</div>
                                              <div class="row2-1 t1-bgA">项目代码</div>
                                              <div class="row2-2">{$data.code}</div>
                                          </div>
                                          <div class="t1-row">
                                              <div class="row1-1 t1-bgA">项目地址</div>
                                              <div class="row4-1">{$data.paddress}</div>
                                              <div class="row2-1 t1-bgA">标段号</div>
                                              <div class="row2-2">{$data.blockname}</div>
                                          </div>
                                          <div class="t1-row">

                                              <div class="row1-1 t1-bgA">当前进度</div>
                                              <div class="row4-1"><!-- 里程碑任务1 -->
                                                  <?php
                                                     $time =time();
                                                     $end = strtotime($data['p_stop']);
                                                  ?>
                                                <if condition="$time gt $end && $data['speed'] neq 2">
                                                <span style="color:red;">项目已超时</span>
                                                <else/>
                                                  {$speed[$data['speed']]}
                                                </if>
                                              </div>
                                           
                                              <div class="row2-1 t1-bgA">项目负责人</div>
                                              <div class="row2-2">{$data.username.name}</div>
                                          </div>
                                          <div class="t1-row">
                                              <div class="row2-1 t1-bgA">项目开始日期</div>
                                              <div class="row2-2">{$data.p_start}</div>
                                              <div class="row2-1 t1-bgA">项目截止日期</div>
                                              <div class="row2-2">{$data.p_stop}</div>
                                              <div class="row2-1 t1-bgA">已用天数</div>
                                              <div class="row2-2">{$day}天</div>
                                          </div>
                                      </div>
                                      <div class="task-details conProj">                                        
                                          <div class="collisionReport-table">
                                              <div class="cRtable-row">
                                                  <div class="cRow-9 cRtable-bg">概况详情</div>                                                 
                                              </div>
                                              <div class="cRtable-row">
                                                  <div class="cRow-9 cRowY">{$data.profile}</div>                                              
                                              </div>
                                          </div>
                                      </div>
                                      <div class="task-details conProj">                                        
                                          <div class="collisionReport-table">
                                              <div class="cRtable-row">
                                                  <div class="cRow-9 cRtable-bg">阶段性成果</div>                                                 
                                              </div>
                                              <div class="cRtable-row">
                                                  <div class="cRow-9 cRowY">{$data.stage}</div>                                              
                                              </div>
                                          </div>
                                      </div>
                                      <div class="task-details conProj">                                        
                                          <div class="collisionReport-table">                                       
                                              <div class="cRtable-row">
                                                  <div class="cRow-9 cRtable-bg">项目统计</div>                                                 
                                              </div>
                                              <div class="cRtable-row">
                                                  <div class="cRow-9 cRowX">
                                                    <ul class="ft-link">
                                                        <div class="col-md-12">
                                                            <div class="row">
                                                                <li><p>任务总数量</p><p>{$count.count}</p></li>
                                                                <li><p>已完成任务</p><p>{$count.ok}</p></li>
                                                                <li><p>未完成任务</p><p>{$count.no}</p></li>
                                                                <li><p>延误任务</p><p>{$count.y}</p></li>
                                                            </div>
                                                        </div>
                                                    </ul>
                                                  </div>                                              
                                              </div>
                                          </div>
                                      </div>

                                      <div class="task-log">
                                          <div class="adv-btn">
                                              <if condition="$data['total_ren'] eq $_SESSION['admin_id']">
                                                <button class="btn btn-primary" data-toggle="modal" href="#proModal1"><i class="icon-edit"></i>编辑项目</button>
                                               <!--  <button class="btn btn-info" data-toggle="modal" href="#proModal2">下发任务</button> -->
                                              </if>
                                          </div>
                                      </div>
                                      <!-- Modal 编辑项目 -->
                                              <div class="modal fade free-trial" id="proModal1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                                                  <div class="modal-dialog bigmodal">
                                                      <div class="modal-content">
                                                          <div class="modal-header">
                                                              <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                                              <h4 class="modal-title">编辑项目</h4>
                                                          </div>
                                                          <div class="modal-body">
                                                            <!--   <div class="form-group">
                                                                  <label class="col-sm-1-8 control-label">项目名称</label>
                                                                  <div class="col-sm-3-8">
                                                                      <input type="text" class="form-control" value="{$data.name}" name="name">
                                                                  </div>
                                                              </div> -->
                                                              <div class="form-group-nohidden">
                                                                  <label class="col-sm-15 control-label">项目名称</label>
                                                                  <div class="col-sm-45">
                                                                      <input type="text" class="form-control" value="{$data.name}" name="name">
                                                                  </div>
                                                                  <label class="col-sm-15 control-label">项目状态</label>
                                                                  <div class="col-sm-45">
                                                                      <select id="speed" class="selectpicker">
                                                                             <option value ="1" <if condition="$data['speed'] eq 1"> selected="selected"</if>>进行中</option>
                                                                             <option value ="2" <if condition="$data['speed'] eq 2"> selected="selected"</if>>已完成</option>
                                                                      </select>
                                                                  </div>
                                                              </div>

                                                              <div class="form-group-nohidden">
                                                                  <label class="col-sm-15 control-label">项目代码</label>
                                                                  <div class="col-sm-45">
                                                                      <input type="text" class="form-control" value="{$data.code}" name="code" maxlength="5" onKeyUp="value=value.replace(/[\W]/g,'')"/>
                                                                  </div>
                                                                  <label class="col-sm-15 control-label">项目负责人</label>
                                                                  <div class="col-sm-45">
                                                                      <select id="total_ren" class="selectpicker" data-live-search="true">
                                                                        <foreach name="user" item="v" key="k">
                                                                          <optgroup label="{$v.cat_name}">
                                                                            <foreach name="v.user" item="vv" key="kk">
                                                                              <option value ="{$vv.admin_id}" <if condition="$data['total_ren'] eq $vv['admin_id']"> selected="selected"</if>>{$vv.name}</option>
                                                                            </foreach>
                                                                          </optgroup>
                                                                        </foreach>
                                                                      </select>
                                                                  </div>
                                                              </div>

                                                              <div class="form-group">
                                                                  <label class="col-sm-15 control-label">项目地址</label>
                                                                  <div class="col-sm-45">
                                                                      <input type="text" class="form-control" value="{$data.paddress}" name="paddress">
                                                                  </div>
                                                                  <label class="col-sm-15 control-label">标段号</label>
                                                                  <div class="col-sm-45">
                                                                      <input type="text" class="form-control" value="{$data.blockname}" name="blockname">
                                                                  </div>
                                                              </div>

                                                              <div class="form-group">                                           
                                                                  <label class="col-sm-15 control-label">项目开始日期</label>
                                                                  <div class="col-sm-45">
                                                                      <div class="input-group date form_datetime-component">
                                                                          <input type="text" readonly="" value="{$data.p_start}" name="p_start" class="form-control">
                                                                              <span class="input-group-btn">
                                                                                  <button class="btn btn-calender date-set" type="button"><i class="icon-calendar"></i></button>
                                                                              </span>
                                                                      </div>
                                                                  </div>
                                                                  <label class="col-sm-15 control-label">项目截止日期</label>
                                                                  <div class="col-sm-45">
                                                                      <div class="input-group date form_datetime-component">
                                                                          <input type="text" readonly="" value="{$data.p_stop}" name="p_stop" class="form-control">
                                                                              <span class="input-group-btn">
                                                                                  <button class="btn btn-calender date-set" type="button"><i class="icon-calendar"></i></button>
                                                                              </span>
                                                                      </div>
                                                                  </div>
                                                              </div>
                                                              <div class="form-group">
                                                                  <label class="col-sm-1-8 control-label">概况详情</label>
                                                                  <div class="col-sm-7-8">
                                                                      <textarea class="form-control error" id="" name="profile" rows="5" required="">{$data.profile}</textarea>
                                                                  </div>
                                                              </div>  
                                                              <div class="form-group">
                                                                  <label class="col-sm-1-8 control-label">阶段性成果</label>
                                                                  <div class="col-sm-7-8">
                                                                      <textarea class="form-control error" id="" name="stage" rows="5" required="">{$data.stage}</textarea>
                                                                  </div>
                                                              </div>
                                                          </div>
                                                          <div class="modal-footer">
                                                              <button data-dismiss="modal" class="btn btn-default" type="button">取消</button>
                                                              <button class="btn btn-submit" type="button" onclick="editproject({$data.id});">修改</button>
                                                          </div>
                                                      </div>
                                                  </div>
                                              </div>
                                              <!-- Modal 编辑项目 -->
                                  </div>
                              </section>
                          </div>
                          <div class="col-lg-12">
                              <section class="panel">
                                  <header class="panel-heading tab-bg-dark-navy-blue ">
                                      <ul class="nav nav-tabs">
                                          <li class="active">
                                              <a data-toggle="tab" href="#ptask-1" onclick="ajaxtask({$data['id']})">子任务</a>
                                          </li>
                                          <li class="">
                                              <a data-toggle="tab" href="#ptask-1" onclick="ajaxplog({$data['id']})">项目日志</a>
                                          </li>
                                      </ul>
                                  </header>
                                  <div class="panel-body">
                                      <div class="tab-content">
                                          <div id="ptask-1" class="tab-pane active">
                                          
                                          </div>
                                          <!-- <div id="ptask-2" class="tab-pane"></div> -->
                                      </div>
                                  </div>
                              </section>
                          </div>
                      </div>
                  </div>
              </div>
          </section>
      </section>
      <!--main content end-->
  </section>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="__PUBLIC__/js/jquery.js"></script>
    <script src="__PUBLIC__/js/jquery-1.8.3.min.js"></script>
    <script src="__PUBLIC__/js/bootstrap.min.js"></script>
    <script src="__PUBLIC__/js/jquery.scrollTo.min.js"></script>
    <script src="__PUBLIC__/js/jquery.nicescroll.js" type="text/javascript"></script>
    <script src="__PUBLIC__/js/jquery.customSelect.min.js" ></script>

    <!--common script for all pages-->
    <script src="__PUBLIC__/js/common-scripts.js"></script>

      <!--new script for this page only-->
       <script src="__PUBLIC__/js/bootstrap-select.js"></script>

      <!--dynamic table initialization -->
      <script src="__PUBLIC__/js/jquery-migrate-1.2.1.min.js"></script>
      <script class="include" type="text/javascript" src="__PUBLIC__/js/jquery.dcjqaccordion.2.7.js"></script>
      <script type="text/javascript" language="javascript" src="__PUBLIC__/assets/advanced-datatable/media/js/jquery.dataTables.js"></script>
      <script type="text/javascript" src="__PUBLIC__/assets/data-tables/DT_bootstrap.js"></script>
	  <script type="text/javascript" src="__PUBLIC__/js/layer/layer.js"></script>

  <script>
      //custom select box
      $(function(){
          $('select.styled').customSelect();
      });
      
      $(document).ready(function(){
          ajaxtask({$pid});
      }); 

      // 编辑项目
      function editproject(id){
    	  var name = $("input[name='name']").val();
    	  var code = $("input[name='code']").val();
    	  var paddress = $("input[name='paddress']").val();
    	  var blockname = $("input[name='blockname']").val();
    	  var p_start = $("input[name='p_start']").val();
    	  var p_stop = $("input[name='p_stop']").val();
    	  var speed = $('#speed option:selected').val();
    	  var total_ren = $('#total_ren option:selected').val();
    	  var stage =  $("textarea[name='stage']").val();
    	  var profile =  $("textarea[name='profile']").val();
    	  if(name==''){
    		  layer.msg('项目名不能为空',{icon:2});
    		  return;
    	  }
    	  if(code==''){
    		  layer.msg('项目代码不能为空',{icon:2});
    		  return;
    	  }
    	  if(paddress=='' || blockname==''){
    		  layer.msg('项目地址或地块有空',{icon:2});
    		  return;
    	  }
    	  if(total_ren=='请选择'){
    		  layer.msg('项目负责人不能为空',{icon:2});
    		  return;
    	  }
    	  if(p_start=='' || p_stop==''){
    		  layer.msg('项目日期不能为空',{icon:2});
    		  return;
    	  }
    	 
    	  if(profile==''){
    		  layer.msg('概况详情不能为空',{icon:2});
    		  return;
    	  }
    	  if(stage==''){
    		  layer.msg('阶段成果不能为空',{icon:2});
    		  return;
    	  }
    		 $.ajax({
 		 		type : 'post',
 		 		url : '__URL__/saveproduct',
 		 		data : {name:name,code:code,paddress:paddress,blockname:blockname,p_start:p_start,p_stop:p_stop,speed:speed,total_ren:total_ren,status:2,id:id,profile:profile,stage:stage},
 		 		dataType : 'json',
 		 		success : function(res){
 		 			 if(res.status==0){
							layer.alert(res.info, {icon: 2});
							return;
						 }
 		 			 if(!res.errNo){
 		 				 layer.msg(res.msg,{icon:1});
 		 				$('#proModal1').modal('hide');
 		 				 $('.modal-backdrop').remove();
                          ajaxtask(id);
                          setTimeout("location.reload()",2000);
 			          }else{
 			        	 layer.msg(res.msg,{icon:2});
 			          }
 		 		}
 		     })
      }
      //项目日志
      function ajaxplog(pid){
    	    $.ajax({
                type : "POST",
                url:'__URL__/ajaxplog',
                data : {pid:pid},
                success: function(res){
              	  if(res.status==0){
							layer.alert(res.info, {icon: 2});
							return;
					   }
                    $("#ptask-1").html('');
                    $("#ptask-1").append(res);
                }
            });
      }
      //ajax子任务
      function ajaxtask(pid,status=0){
    	  $.ajax({
              type : "POST",
              url:'__URL__/ajaxtask',
              data : {pid:pid,status:status},
              success: function(res){
            	  if(res.status==0){
							layer.alert(res.info, {icon: 2});
							return;
					   }
                  $("#ptask-1").html('');
                  $("#ptask-1").append(res);
              }
          });
      }
      //chage
      function ctype(o,pid){
    	  var status = o.value;
    	  ajaxtask(pid,status);
      }
  </script>
  </body>
</html>
